package com.zelma.mywebsocket.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

import java.util.List;
@Component
public class Rediss {
    @Autowired
    StringRedisTemplate redisTemplate;

    public  List<String> redis(){
        String s = redisTemplate.opsForValue().get("status");
        if (s.equals("user")){
            List<String> agents = redisTemplate.opsForList().range("agents", 0, -1);
            return agents;
        }else {
            List<String> users = redisTemplate.opsForList().range("users", 0, -1);
            return users;
        }
    }
}
